<template>
    <div>
        <el-input
            style="width: 150px; margin-right: 15px"
            placeholder="请输入员工编号"
            v-model="employeeEc.eid"
            clearable
        ></el-input>
        <el-select
            v-model="employeeEc.ecType"
            placeholder="请选择奖罚类别"
            clearable
            filterable
            style="margin-right: 15px;width: 150px;"
        >
            <el-option
                v-for="(item, index) in ecType"
                :key="index"
                :label="item"
                :value="item"
            ></el-option>
        </el-select>
        <el-input
            style="width: 500px; margin-right: 15px"
            suffix-icon="el-icon-plus"
            v-model="employeeEc.ecReason"
            placeholder="请输入奖罚原因"
            clearable
        ></el-input>
        <el-button
            type="primary"
            size="small"
            icon="el-icon-plus"
            @click="addEmployeeEc"
            >添加</el-button
        >
        <el-button type="danger" size="small">批量删除</el-button>

        <el-table
            :data="employeeEcs"
            style="width: 100%; margin-top: 15px"
            border
            stripe
        >
            <el-table-column type="selection" align="center"></el-table-column>
            <el-table-column prop="eid" label="员工编号" align="center">
            </el-table-column>
            <el-table-column prop="ecDate" label="奖罚日期" align="center">
            </el-table-column>
            <el-table-column prop="ecPoint" label="奖罚分" align="center">
            </el-table-column>
            <el-table-column prop="ecReason" label="奖罚原因" align="center">
            </el-table-column>
            <el-table-column prop="ecType" label="奖罚类别" align="center">
                <template scope="scope">
                    <el-tag v-if="scope.row.ecType === 0" type="primary"
                        >奖</el-tag
                    >
                    <el-tag v-else>罚</el-tag>
                </template>
            </el-table-column>
            <el-table-column prop="remark" label="备注" align="center">
            </el-table-column>
            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button type="success" size="mini">编辑</el-button>
                    <el-button type="danger" size="mini">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
export default {
    data() {
        return {
            employeeEc: {
                eid: "",
                ecType: "",
                ecReason: "",
            },
            ecType: ["奖", "罚"],
            // 页面数据
            employeeEcs: [],
        };
    },
    created() {
        this.initEmployeeEc();
    },
    methods: {
        // 初始化数据
        initEmployeeEc() {
            this.getRequest("/employeeEc/getEmployeeEcRecords").then((res) => {
                if (res) {
                    this.employeeEcs = res;
                }
            });
        },
        // 添加
        addEmployeeEc() {
            // this.postRequest('/employeeEc/addEmployeeEc',this.employeeEc)
        },
    },
};
</script>

<style>
</style>